/**
 * com.dingjian.base.util.SystemConfig.java
 */
package com.monte.util;
import java.io.IOException;
import java.util.Properties;

import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;

import com.monte.spring.ApplicationContextAware;

/**
 * 系统参数类
 * @author FengMy
 * 
 * @since 2012-10-29
 */
@Component(value="systemConfig")
public class SystemConfig {
	private Resource res;
	private Properties pros = new Properties();

	public void setResource(Resource resource) throws IOException{
		this.res = resource;
		pros.load(res.getInputStream());
	}
	/**
	 * 获取系统参数
	 * @param key
	 * @return
	 */
	public static String getParameter(String key){
		SystemConfig cfg = ApplicationContextAware.getApplicationContext().getBean("systemConfig", SystemConfig.class);
		return cfg.pros.getProperty(key);
	}
}
